package org.ztr.aiollama.entity.vo;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.ai.chat.messages.Message;

/**
 * @Author: ZhaoTR
 * @Date: Created in 2025/9/20 20:44
 * @Description: 聊天消息
 * @Version: 1.0
 */
@NoArgsConstructor
@Accessors(chain = true)
public class MessageVO {

    private String role;
    private String content;

    public MessageVO(Message message) {
        this.role = switch (message.getMessageType()) {
            case USER -> "user";
            case ASSISTANT -> "assistant";
            case SYSTEM -> "system";
            default -> "";
        };
        this.content = message.getText();
    }

    public String getRole() { return role; }
    public String getContent() { return content; }

    public MessageVO setRole(String role) {
        this.role = role;
        return this;
    }

    public MessageVO setContent(String content) {
        this.content = content;
        return this;
    }
}
